package com.zlict.admin.service.impl;

import com.zlict.admin.domain.ProjectAchievement;
import com.zlict.admin.mapper.ProjectAchievementMapper;
import com.zlict.admin.service.IProjectAchievementService;
import com.zlict.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.zlict.common.utils.SecurityUtils.getUserId;

/**
 * 项目成果Service业务层处理
 * 
 * @author dzw
 * @date 2025-06-11
 */
@Service
public class ProjectAchievementServiceImpl implements IProjectAchievementService 
{
    @Autowired
    private ProjectAchievementMapper projectAchievementMapper;

    /**
     * 查询项目成果
     * 
     * @param id 项目成果主键
     * @return 项目成果
     */
    @Override
    public ProjectAchievement selectProjectAchievementById(Long id)
    {
        return projectAchievementMapper.selectProjectAchievementById(id);
    }

    /**
     * 查询项目成果列表
     * 
     * @param projectAchievement 项目成果
     * @return 项目成果
     */
    @Override
    public List<ProjectAchievement> selectProjectAchievementList(ProjectAchievement projectAchievement)
    {
        return projectAchievementMapper.selectProjectAchievementList(projectAchievement);
    }

    /**
     * 新增项目成果
     * 
     * @param projectAchievement 项目成果
     * @return 结果
     */
    @Override
    public int insertProjectAchievement(ProjectAchievement projectAchievement)
    {
        projectAchievement.setCreateTime(DateUtils.getNowDate());
        projectAchievement.setCreateBy(getUserId());
        return projectAchievementMapper.insertProjectAchievement(projectAchievement);
    }

    /**
     * 修改项目成果
     * 
     * @param projectAchievement 项目成果
     * @return 结果
     */
    @Override
    public int updateProjectAchievement(ProjectAchievement projectAchievement)
    {
        projectAchievement.setUpdateTime(DateUtils.getNowDate());
        projectAchievement.setUpdateBy(getUserId());
        return projectAchievementMapper.updateProjectAchievement(projectAchievement);
    }

    /**
     * 批量删除项目成果
     * 
     * @param ids 需要删除的项目成果主键
     * @return 结果
     */
    @Override
    public int deleteProjectAchievementByIds(Long[] ids)
    {
        return projectAchievementMapper.deleteProjectAchievementByIds(ids);
    }

    /**
     * 删除项目成果信息
     * 
     * @param id 项目成果主键
     * @return 结果
     */
    @Override
    public int deleteProjectAchievementById(Long id)
    {
        return projectAchievementMapper.deleteProjectAchievementById(id);
    }
}
